<?php
/* @var $this PostController */
/* @var $model Post*/
$this->breadcrumbs = array(
   'Quản lý bài đăng' => '/admin/'.$this->id,
   'Đăng bài'
);

?>
<div class="form" id="<?php echo Yii::app()->controller->id . '-' . Yii::app()->controller->action->id?>">
<?php
   $form = $this->beginWidget('CActiveForm',array(
      'enableClientValidation' => true,
      'clientOptions'=>array(
   		'validateOnSubmit'=>true,
   	),
      'htmlOptions' => array(
         'class' => 'form-horizontal',
         'enctype' => 'multipart/form-data',
      ),
      'id' => Yii::app()->controller->id . '_' . Yii::app()->controller->action->id )
   );
?>
   <p class="note">Những dòng đánh dấu <span class="required">*</span> là bắt buộc.</p>

	<?php echo $form->errorSummary($model,'Kiểm tra lại các giá trị bạn vừa nhập vào'); 
      if($message != ''){
         echo CHtml::tag('div', array('class'=>'message-success'),$message);
      }
   ?>
   <input name="session_user" type="hidden" value="<?php echo $session_user?>"/>
   <input name="action_user" type="hidden" value="" id="action_user" />
   <div class="control-group">
      <?php echo $form->labelEx($model, 'news_title',array('class' => 'control-label'));?>
      <div class="controls">
         <?php echo $form->textField($model, 'news_title',array('style' => 'width:500px;'));?>
      </div>
   </div>
   <div class="control-group">
      <?php echo $form->labelEx($model, 'news_content',array('class' => 'control-label'));?>
      <div class="controls">
         <?php echo $form->textArea($model, 'news_content',array('class' => 'redactor'));?>
      </div>
   </div>
   <div class="control-group">
      <?php echo $form->labelEx($model,'news_image',array('class' => 'control-label')); ?>
      <div class="controls">
      <input id="News_attachments" type="file" name="News[attachments][]" value="" multiple="multiple"/>
      </div>
   </div>
   <div class="control-group">
      <?php echo $form->labelEx($model, 'news_type',array('class' => 'control-label'));?>
      <div class="controls radio-group">
         <?php echo $form->radioButtonList($model,'news_type',array(0=>'Tin tức',1=>'Dự án công ty',2 => 'Phong thủy'), array('separator' => '',/* 'onchange' => 'menuTypeChange(this.value);'*/)); ?>
      </div>
   </div>
   <div class="control-group">
      <?php echo $form->labelEx($model, 'news_active',array('class' => 'control-label'));?>
      <div class="controls">
         <?php echo $form->checkBox($model, 'news_active',array('checked' => 'checked'));?>
      </div>
   </div>
   <div class="form-actions">
      <?php echo CHtml::submitButton(($model->isNewRecord) ? 'Thêm mới' : 'Lưu',array('class' => 'btn btn-info'))?>
      <?php echo CHtml::resetButton('Hủy',array('class' => 'btn btn-warning','onclick' => 'window.history.go(-1)'))?>
	</div>
<?php $this->endWidget(); ?>
</div>
<script>
   $(document).ready(function(){
      $(".redactor").redactor({
         lang: 'vi',
         imageUpload: '<?php echo Yii::app()->request->hostInfo;?>/redactor/scripts/image_upload.php',
         plugins: ['fontsize']
      });
   });
</script>
